home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Text / WASTE / WASTE 1.1.2 Distribution / Pseudo-UPI for THINK Pascal / QuickdrawText.p < prev    next >
Encoding:
Text File  |  1995-10-12  |  4.7 KB  |  163 lines  |  [TEXT/PJMM]

  1. unit QuickdrawText;
  2.  
  3. { Pascal Interface to the Macintosh Libraries }
  4.  
  5. { Copyright © Apple Computer Inc. }
  6. { All Rights Reserved }
  7.  
  8. { Adapted for use with THINK Pascal 4.0.x by Marco Piovanelli }
  9.  
  10. interface
  11.     uses
  12.         Types;
  13.  
  14.     const
  15.  
  16. { CharToPixel directions }
  17.         leftCaret = 0;                            {Place caret for left block}
  18.         rightCaret = -1;                            {Place caret for right block}
  19.         hilite = 1;                            {Direction is SysDirection}
  20.         smLeftCaret = 0;                            {Place caret for left block - obsolete }
  21.         smRightCaret = -1;                            {Place caret for right block - obsolete }
  22.         smHilite = 1;                            {Direction is TESysJust - obsolete }
  23. {Constants for styleRunPosition argument in PortionLine, DrawJustified,}
  24. { MeasureJustified, CharToPixel, and PixelToChar.}
  25.         onlyStyleRun = 0;                            { This is the only style run on the line }
  26.         leftStyleRun = 1;                            { This is leftmost of multiple style runs on the line }
  27.         rightStyleRun = 2;                            { This is rightmost of multiple style runs on the line }
  28.         middleStyleRun = 3;                            { There are multiple style runs on the line and this }
  29. { is neither the leftmost nor the rightmost. }
  30.         smOnlyStyleRun = 0;                            { obsolete }
  31.         smLeftStyleRun = 1;                            { obsolete }
  32.         smRightStyleRun = 2;                            { obsolete }
  33.         smMiddleStyleRun = 3;                            { obsolete }
  34.  
  35. { type for styleRunPosition parameter in PixelToChar etc. }
  36.  
  37.     type
  38.         JustStyleCode = INTEGER;
  39.  
  40.         FormatOrder = array[0..0] of INTEGER;
  41.  
  42.         FormatOrderPtr = ^FormatOrder;
  43.  
  44.         FormatStatus = INTEGER;
  45.  
  46.         OffPair = record
  47.                 offFirst: INTEGER;
  48.                 offSecond: INTEGER;
  49.             end;
  50.         OffsetTable = array[0..2] of OffPair;
  51.  
  52.         StyleRunDirectionProcPtr = ProcPtr;  { FUNCTION StyleRunDirection(styleRunIndex: INTEGER; dirParam: UNIV Ptr): BOOLEAN; }
  53.         StyleRunDirectionUPP = UniversalProcPtr;
  54.  
  55.     const
  56.         uppStyleRunDirectionProcInfo = $00000390; { FUNCTION (2 byte param, 4 byte param): 1 byte result; }
  57.  
  58.     function NewStyleRunDirectionProc (userRoutine: StyleRunDirectionProcPtr): StyleRunDirectionUPP;
  59.     inline
  60.         $2E9F;
  61.  
  62.     function CallStyleRunDirectionProc (styleRunIndex: INTEGER;
  63.                                     dirParam: univ Ptr;
  64.                                     userRoutine: StyleRunDirectionUPP): BOOLEAN;
  65.     inline
  66.         $205F, $4E90;
  67.  
  68.     function Pixel2Char (textBuf: Ptr;
  69.                                     textLen: INTEGER;
  70.                                     slop: INTEGER;
  71.                                     pixelWidth: INTEGER;
  72.                                     var leadingEdge: BOOLEAN): INTEGER;
  73.     inline
  74.         $2F3C, $820E, $0014, $A8B5;
  75.     function Char2Pixel (textBuf: Ptr;
  76.                                     textLen: INTEGER;
  77.                                     slop: INTEGER;
  78.                                     offset: INTEGER;
  79.                                     direction: INTEGER): INTEGER;
  80.     inline
  81.         $2F3C, $820C, $0016, $A8B5;
  82.     function PixelToChar (textBuf: Ptr;
  83.                                     textLength: LONGINT;
  84.                                     slop: Fixed;
  85.                                     pixelWidth: Fixed;
  86.                                     var leadingEdge: BOOLEAN;
  87.                                     var widthRemaining: Fixed;
  88.                                     styleRunPosition: JustStyleCode;
  89.                                     numer: Point;
  90.                                     denom: Point): INTEGER;
  91.     inline
  92.         $2F3C, $8222, $002E, $A8B5;
  93.     function CharToPixel (textBuf: Ptr;
  94.                                     textLength: LONGINT;
  95.                                     slop: Fixed;
  96.                                     offset: LONGINT;
  97.                                     direction: INTEGER;
  98.                                     styleRunPosition: JustStyleCode;
  99.                                     numer: Point;
  100.                                     denom: Point): INTEGER;
  101.     inline
  102.         $2F3C, $821C, $0030, $A8B5;
  103.     procedure DrawJustified (textPtr: Ptr;
  104.                                     textLength: LONGINT;
  105.                                     slop: Fixed;
  106.                                     styleRunPosition: JustStyleCode;
  107.                                     numer: Point;
  108.                                     denom: Point);
  109.     inline
  110.         $2F3C, $8016, $0032, $A8B5;
  111.     procedure MeasureJustified (textPtr: Ptr;
  112.                                     textLength: LONGINT;
  113.                                     slop: Fixed;
  114.                                     charLocs: Ptr;
  115.                                     styleRunPosition: JustStyleCode;
  116.                                     numer: Point;
  117.                                     denom: Point);
  118.     inline
  119.         $2F3C, $801A, $0034, $A8B5;
  120.     function PortionLine (textPtr: Ptr;
  121.                                     textLen: LONGINT;
  122.                                     styleRunPosition: JustStyleCode;
  123.                                     numer: Point;
  124.                                     denom: Point): Fixed;
  125.     inline
  126.         $2F3C, $8412, $0036, $A8B5;
  127.     procedure HiliteText (textPtr: Ptr;
  128.                                     textLength: INTEGER;
  129.                                     firstOffset: INTEGER;
  130.                                     secondOffset: INTEGER;
  131.                                     var offsets: OffsetTable);
  132.     inline
  133.         $2F3C, $800E, $001C, $A8B5;
  134.     procedure DrawJust (textPtr: Ptr;
  135.                                     textLength: INTEGER;
  136.                                     slop: INTEGER);
  137.     inline
  138.         $2F3C, $8008, $001E, $A8B5;
  139.     procedure MeasureJust (textPtr: Ptr;
  140.                                     textLength: INTEGER;
  141.                                     slop: INTEGER;
  142.                                     charLocs: Ptr);
  143.     inline
  144.         $2F3C, $800C, $0020, $A8B5;
  145.     function PortionText (textPtr: Ptr;
  146.                                     textLength: LONGINT): Fixed;
  147.     inline
  148.         $2F3C, $8408, $0024, $A8B5;
  149.     function VisibleLength (textPtr: Ptr;
  150.                                     textLength: LONGINT): LONGINT;
  151.     inline
  152.         $2F3C, $8408, $0028, $A8B5;
  153.     procedure GetFormatOrder (ordering: FormatOrderPtr;
  154.                                     firstFormat: INTEGER;
  155.                                     lastFormat: INTEGER;
  156.                                     lineRight: BOOLEAN;
  157.                                     rlDirProc: StyleRunDirectionUPP;
  158.                                     dirParam: Ptr);
  159.     inline
  160.         $2F3C, $8012, $FFFC, $A8B5;
  161.  
  162. implementation
  163. end.